package com.wlx.common.mongodb;

import java.util.Collections;
import java.util.List;

/**
 * @author: Admin
 * @date: 2021/2/24
 * @description:
 * @copyright: 重庆万蓝兴科技有限公司
 */
public class MongoDbResult<T> {
    /**
     * 数据记录
     */
    private List<T> records;
    /**
     * 总记录数
     */
    private long total;
    /**
     * 每页展示数
     */
    private long size;
    /**
     * 当前页
     */
    private long current;

    public MongoDbResult() {
        this.records = Collections.emptyList();
        this.total = 0L;
        this.size = 10L;
        this.current = 1L;
    }


    public MongoDbResult(long current, long size) {
        this.records = Collections.emptyList();
        this.total = 0L;
        this.size = 10L;
        this.current = 1L;
        if (current > 1L) {
            this.current = current;
        }
        this.size = size;
    }

    public List<T> getRecords() {
        return records;
    }

    public MongoDbResult setRecords(List<T> records) {
        this.records = records;
        return this;
    }

    public long getTotal() {
        return total;
    }

    public MongoDbResult setTotal(long total) {
        this.total = total;
        return this;
    }

    public long getSize() {
        return size;
    }

    public void setSize(long size) {
        this.size = size;
    }

    public long getCurrent() {
        return current;
    }

    public void setCurrent(long current) {
        this.current = current;
    }
}
